package matlap.server;

import java.util.List;

import matlap.client.services.news.NewsService;
import matlap.database.dao.DAOFactory;
import matlap.database.dao.NewsDAO;
import matlap.shared.New;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

/**
 * The server side implementation of the RPC service.
 */

public class NewsServiceImpl extends RemoteServiceServlet implements
		NewsService {

	/**
	 * 
	 */
	private static final long serialVersionUID = -6275870125614894055L;
	DAOFactory df = DAOFactory.getInstance();
	NewsDAO nd = df.getNewsDAO();

	/**
	 * Turns back all of the news in New list.
	 */

	@Override
	public List<New> getNews() {
		return nd.getNews();
	}

	/**
	 * Turns back all of the newa in New by adding news title.
	 */

	@Override
	public New getNewsByTitle(String title) {
		return nd.getNewsByTitle(title);
	}

	/**
	 * Inserts news into news table by adding New.
	 */

	@Override
	public void insertNews(New n) {
		nd.insertNews(n);
	}

	/**
	 * Updates news table by adding new.
	 */

	@Override
	public void updateNews(New n) {
		nd.updateNews(n);
	}

	/**
	 * Deletes news by adding news title in new.
	 */

	@Override
	public void deleteNews(New n) {
		nd.deleteNews(n);
	}

}
